package com.xy.job.executor.core.job

import kotlinx.coroutines.Job
import java.util.concurrent.ConcurrentHashMap

internal object JobRegistry {

    private val jobRegistry = ConcurrentHashMap<Long, Job>()

    fun register(jobInstanceId: Long, job: Job) {
        jobRegistry[jobInstanceId] = job
    }

    fun remove(jobInstanceId: Long): Job? {
        return jobRegistry.remove(jobInstanceId)
    }
}